<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增指标标签')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-label-add">
            <input id="treeId" name="parentId" type="hidden" th:value="${parentId}"/>
            <div class="form-group">
                <label class="col-sm-3 control-label">上级：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                    <input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept?.deptName}" >
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">编码：</label>
                <div class="col-sm-8">
                    <input name="cd" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input name="na" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">启用标志：</label>
                <div class="col-sm-8">
                    <select name="fgAct" class="form-control m-b">
                        <option value=1 >启用</option>
                        <option value=0 >停用</option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "base/label";
        $("#form-label-add").validate({
            focusCleanup: true
        });
        /*部门管理-新增-选择父部门树*/
        function selectDeptTree() {

           var treeId = $("#treeId").val();
            var options = {
                title: '选择上级',
                width: "380",
                url: prefix + "/tree/"+(treeId==""?0:treeId),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }
        function doSubmit(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            $.modal.close(index);
        }
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-label-add').serialize());
            }
        }


    </script>
</body>
</html>